﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="fsw.Web.Mould.Edit" ValidateRequest="false" %>

<%@ Register Src="~/HeaderJs.ascx" TagPrefix="uc1" TagName="HeaderJs" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="renderer" content="webkit" />
    <title>编辑模块</title>
    <uc1:HeaderJs runat="server" ID="HeaderJs" />
</head>
<body>
    <div class="position">当前位置：模块管理  > <a href="List.aspx">模块管理</a>> <a href="Add.aspx">模块添加</a></div>
    <div class="border">
        <legend>编辑项目</legend>
        <form id="form1" class="am-form am-form-horizontal" runat="server">
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">模块名称</label>
                <div class="am-u-sm-10">
                    <input type="text" name="MouldName" size="50" maxlength="50" placeholder="请输入模块名称" value="<%=Mould_Model.MouldName %>" data-rule="模块名称:required;" />
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">排序</label>
                <div class="am-u-sm-10">
                    <input type="text" name="OrderNo" size="30" value="<%=Mould_Model.OrderNo.ToString() %>" />
                    <span class="am-margin-left input-tips">数字越大越靠前</span>
                </div>
            </div>
            <div class="am-form-group">
                <div class="am-u-sm-10 am-u-sm-offset-2">
                    <button type="submit" class="am-btn am-btn-primary am-radius">保存</button>
                    <button type="button" class="am-btn am-radius am-back">返回</button>
                </div>
            </div>
        </form>
        <script>
            $(function () {
                toastr.options = { "positionClass": "toast-bottom-center", "timeOut": "3000", "onclick": null, showMethod: "slideDown", hideMethod: "slideUp" };
                $('.am-form').validator({
                    timely: 2,
                    stopOnError: true,
                    focusCleanup: true,
                    ignore: ':hidden',
                    theme: 'yellow_right_effect',
                    msgMaker: function (opt) { if (opt.type == 'error') { toastr.clear(); toastr.error(opt.msg); } },
                    valid: function (form) {
                        $.AMUI.progress.inc();
                        $.ajax({
                            type: 'post',
                            cache: false,
                            dataType: 'json',
                            url: 'Edit.aspx?id=<%=Mould_Model.Id %>',
                            data: $(form).serialize(),
                            error: function (e) { alert(e.responseText); },
                            success: function (d) {
                                $.AMUI.progress.set(1.0);
                                if (d.state == 'success') {
                                    toastr.success(d.msg);
                                    setTimeout(function () { location.href = 'List.aspx'; }, 1500);
                                }
                                else {
                                    toastr.error(d.msg);
                                }

                            }
                        })
                    }
                });

            })
        </script>
</body>
</html>
